package com.bfsd.tieba.agent.tieba_agent.config;

import com.bfsd.tieba.agent.tieba_agent.tools.TieBaTools;
import jakarta.annotation.Resource;
import org.springframework.ai.chat.client.ChatClient;
import org.springframework.ai.chat.client.advisor.MessageChatMemoryAdvisor;
import org.springframework.ai.chat.memory.InMemoryChatMemory;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import java.io.IOException;


@Configuration
public class ChatClientConfig {

    @Resource
    TieBaTools tools;

    @Bean
    ChatClient chatClient(ChatClient.Builder builder) throws IOException {
        return builder
                .defaultAdvisors(new MessageChatMemoryAdvisor(new InMemoryChatMemory()))
                .defaultTools(tools)
                .build();
    }
}
